package com.yunxi.product.service.impl;

import com.yunxi.product.bean.Product;
import com.yunxi.product.service.ProductService;
import org.springframework.stereotype.Service;

import java.math.BigDecimal;

/**
 * 商品业务实现
 *
 * @author: lidy
 * @date: 2025-01-17 10:26
 */
@Service
public class ProductServiceImpl implements ProductService {

    @Override
    public Product getProduct(Long productId) {
        Product product = new Product();

        product.setId(productId);
        product.setPrice(new BigDecimal("199"));
        product.setProductName("苹果-" + productId);
        product.setNum(3);

        // 模拟远程调用超时
//        try {
//            TimeUnit.SECONDS.sleep(100);
//        } catch (InterruptedException e) {
//            throw new RuntimeException(e);
//        }

        return product;
    }

}
